﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using QLST_DTO;
using QLST_BUS;

namespace QLST_CoopMart_GoVap
{
    public partial class frmMain : Form
    {
        public static int MaPQ = -1;
        public static NHAN_VIEN NV;
        public frmMain()
        {
            InitializeComponent();
        }
        public void LoadPanel()
        {
            switch(NV.MaLoaiNV)
            {
                case 1:
                    {
                        //Nhân viên quản lý
                        LoadPanel(new uc_QLTaiKhoan());
                    }
                    break;
                case 2:
                    {
                        //Nhân viên kế toán
                      //  LoadPanel(new uc_QLTaiKhoan());
                    }
                    break;
                case 3:
                    { 
                        //Nhân viên thu ngân
                        LoadPanel(new uc_BanHang());
                    }break;
                case 4:
                    {
                        //Nhân viên kho
                        LoadPanel(new ucMain_NhanVienPP());
                    }break;
            }
        }

        private void báoCáoHàngTronKhoToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            if (NV != null)
            {
                LoadPanel();
            }
        }

        /// <summary>
        /// Hàm hiển thị use control
        /// </summary>
        /// <param name="uc"></param>
        public void LoadPanel(UserControl uc)
        {
            this.pnlMain.Dock = DockStyle.Fill;
            pnlMain.Controls.Clear();
            uc.Dock = DockStyle.Fill;
            pnlMain.Controls.Add(uc);

        }

        private void btnQLKhuyenMai_Click(object sender, EventArgs e)
        {
           // LoadPanel(new uc_QLTaiKhoan());
        }

        private void btnQlQuay_Click(object sender, EventArgs e)
        {
           
        }

        private void btnQlQuay_Click_1(object sender, EventArgs e)
        {
          
        }

        private void btnQLHangHoa_Click(object sender, EventArgs e)
        {
            LoadPanel(new uc_QuanLySanPham());
        }

        private void btnQLDonHang_Click(object sender, EventArgs e)
        {
            LoadPanel(new uc_BanHang());
        }

        private void btnQLTaiKhoan_Click(object sender, EventArgs e)
        {
            LoadPanel(new ucMain_NhanVienPP());
        }
    }
}
